angular.module('starter.controllers', [])
    .controller('MainCtrl', function ($rootScope, $scope, $window, $location,NAV,Static,getData) {
        $rootScope.nav = 0;

        $rootScope.window = $window;
        $rootScope.jqueryInit = function () {
            $(function () {

            })

        }
        $rootScope.location = $location;
        $scope.url = $location.$$path;

        console.log($scope.url.indexOf('/top'));

    })
    .controller('HomeCtrl', function ($rootScope, $scope, getData,Static) {

        $rootScope.jqueryInit();
        var url =  Static.host + "/?r=Youku/GetSokuList&data={q:'dota',cp:%s,od:1,lt:0,limitdate:0}";
        var params = {url:url};
        $scope.getData = new getData(params);
        $rootScope.nav = 0;


    })

    .controller('UsersCtrl',function($rootScope, $scope, getData,Static){

        var url =  Static.host + "/?r=Youku/GetSokuUser&data={q:'dota',cp:%s}";
        var params = {url:url};
        $scope.getData = new getData(params);
        $rootScope.nav = 1;




    })



    .controller('TopCtrl', function ($rootScope, $scope, getData,Static,$stateParams,$location) {
        $rootScope.jqueryInit();
        $scope.type = $stateParams.type || 7;
        var url =  Static.host + "/?r=Youku/GetSokuList&data={q:'dota',cp:%s,od:3,lt:0,limitdate:"+$scope.type+"}";
        var params = {url:url};
        $scope.getData = new getData(params);

        $scope.setType = function(type){
            $location.path("/top/" +type);
            console.log(type);
        }
        $rootScope.nav = 2;



    })